/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 80025 (8.0.25)
 Source Host           : localhost:3306
 Source Schema         : ygswglxt

 Target Server Type    : MySQL
 Target Server Version : 80025 (8.0.25)
 File Encoding         : 65001

 Date: 08/11/2025 14:53:25
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for attendance_record
-- ----------------------------
DROP TABLE IF EXISTS `attendance_record`;
CREATE TABLE `attendance_record` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL,
  `date` date DEFAULT NULL COMMENT '日期',
  `check_in_time` datetime DEFAULT NULL,
  `check_out_time` datetime DEFAULT NULL,
  `type` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'CHECK_IN, CHECK_OUT, OVERTIME',
  `hours` decimal(5,2) DEFAULT NULL COMMENT '加班时长（小时）',
  `overtime_date` date DEFAULT NULL COMMENT '加班日期',
  `reason` text COLLATE utf8mb4_unicode_ci COMMENT '加班原因',
  `status` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'PENDING, APPROVED, REJECTED',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
  `is_late` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦è¿Ÿåˆ°ï¼š0-å¦ï¼Œ1-æ˜¯',
  `is_early_leave` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦æ—©é€€ï¼š0-å¦ï¼Œ1-æ˜¯',
  `is_absent` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦ç¼ºå‹¤ï¼š0-å¦ï¼Œ1-æ˜¯',
  `late_minutes` int DEFAULT NULL COMMENT 'è¿Ÿåˆ°åˆ†é’Ÿæ•°',
  `early_leave_minutes` int DEFAULT NULL COMMENT 'æ—©é€€åˆ†é’Ÿæ•°',
  `attendance_date` date DEFAULT NULL COMMENT 'è€ƒå‹¤æ—¥æœŸ',
  `exception_reason` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'å¼‚å¸¸åŽŸå› ',
  `exception_status` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT 'UNHANDLED' COMMENT 'å¼‚å¸¸å¤„ç†çŠ¶æ€ï¼šUNHANDLED-æœªå¤„ç†, HANDLED-å·²å¤„ç†, IGNORED-å·²å¿½ç•¥',
  `exception_handler_id` bigint DEFAULT NULL COMMENT 'å¼‚å¸¸å¤„ç†äººID',
  `exception_handle_time` datetime DEFAULT NULL COMMENT 'å¼‚å¸¸å¤„ç†æ—¶é—´',
  `exception_handle_remark` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'å¼‚å¸¸å¤„ç†å¤‡æ³¨',
  PRIMARY KEY (`id`),
  KEY `idx_exception_status` (`exception_status`),
  KEY `idx_attendance_date_exception` (`attendance_date`,`exception_status`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
-- Records of attendance_record
-- ----------------------------
BEGIN;
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (1, 1, '2025-11-06', '2025-11-06 23:49:28', NULL, 'CHECK_IN', NULL, NULL, NULL, 'APPROVED', '2025-11-06 23:49:28', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (2, 1, NULL, NULL, '2025-11-06 23:49:30', 'CHECK_OUT', NULL, NULL, NULL, 'APPROVED', '2025-11-06 23:49:30', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (3, 1, NULL, NULL, NULL, 'OVERTIME', NULL, NULL, NULL, 'REJECTED', '2025-11-06 23:49:33', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (4, 1, '2025-11-06', '2025-11-06 23:55:36', NULL, 'CHECK_IN', NULL, NULL, NULL, 'APPROVED', '2025-11-06 23:55:36', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (5, 2, NULL, NULL, '2025-11-07 00:04:00', 'CHECK_OUT', NULL, NULL, NULL, 'APPROVED', '2025-11-07 00:04:00', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (6, 2, '2025-11-07', '2025-11-07 00:04:02', NULL, 'CHECK_IN', NULL, NULL, NULL, 'APPROVED', '2025-11-07 00:04:02', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (7, 1, '2025-11-07', '2025-11-07 00:16:21', NULL, 'CHECK_IN', NULL, NULL, NULL, 'APPROVED', '2025-11-07 00:16:21', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (8, 3, '2025-11-07', '2025-11-07 00:27:04', NULL, 'CHECK_IN', NULL, NULL, NULL, 'APPROVED', '2025-11-07 00:27:04', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (9, 3, NULL, NULL, '2025-11-07 00:27:05', 'CHECK_OUT', NULL, NULL, NULL, 'APPROVED', '2025-11-07 00:27:05', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (10, 1, '2025-11-06', '2025-11-06 00:00:00', NULL, 'OVERTIME', NULL, NULL, NULL, 'REJECTED', '2025-11-07 01:10:52', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (11, 1, '2025-11-06', '2025-11-06 00:00:00', NULL, 'OVERTIME', NULL, NULL, NULL, 'REJECTED', '2025-11-07 01:11:59', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (12, 1, '2025-11-06', '2025-11-06 00:00:00', NULL, 'OVERTIME', 2.00, '2025-11-06', '去问问晴娃娃儿', 'APPROVED', '2025-11-07 01:14:16', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (13, 1, NULL, '2025-11-07 01:19:11', NULL, 'CHECK_IN', NULL, NULL, NULL, 'APPROVED', '2025-11-07 01:19:11', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (14, 1, NULL, '2025-11-07 01:19:30', NULL, 'CHECK_IN', NULL, NULL, NULL, 'APPROVED', '2025-11-07 01:19:30', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (15, 1, NULL, '2025-11-07 01:20:31', NULL, 'CHECK_IN', NULL, NULL, NULL, 'APPROVED', '2025-11-07 01:20:31', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (16, 1, NULL, '2025-11-07 01:20:43', NULL, 'CHECK_IN', NULL, NULL, NULL, 'APPROVED', '2025-11-07 01:20:43', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (17, 1, NULL, '2025-11-07 01:21:01', NULL, 'CHECK_IN', NULL, NULL, NULL, 'APPROVED', '2025-11-07 01:21:01', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (18, 1, NULL, NULL, '2025-11-07 01:21:08', 'CHECK_OUT', NULL, NULL, NULL, 'APPROVED', '2025-11-07 01:21:08', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (19, 2, NULL, '2025-11-07 01:21:50', NULL, 'CHECK_IN', NULL, NULL, NULL, 'APPROVED', '2025-11-07 01:21:50', 0, 0, 0, NULL, NULL, NULL, NULL, 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (20, 3, NULL, '2025-11-07 15:17:42', NULL, 'CHECK_IN', NULL, NULL, NULL, 'APPROVED', '2025-11-07 15:17:42', 1, 0, 0, 377, NULL, '2025-11-07', '迟到 377 分钟', 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (21, 4, NULL, '2025-11-07 15:18:11', NULL, 'CHECK_IN', NULL, NULL, NULL, 'APPROVED', '2025-11-07 15:18:11', 1, 0, 0, 378, NULL, '2025-11-07', '迟到 378 分钟', 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (22, 1, NULL, NULL, '2025-11-07 15:24:24', 'CHECK_OUT', NULL, NULL, NULL, 'APPROVED', '2025-11-07 15:24:24', 0, 1, 0, NULL, 155, '2025-11-07', '早退 155 分钟', 'UNHANDLED', NULL, NULL, NULL);
INSERT INTO `attendance_record` (`id`, `user_id`, `date`, `check_in_time`, `check_out_time`, `type`, `hours`, `overtime_date`, `reason`, `status`, `create_time`, `is_late`, `is_early_leave`, `is_absent`, `late_minutes`, `early_leave_minutes`, `attendance_date`, `exception_reason`, `exception_status`, `exception_handler_id`, `exception_handle_time`, `exception_handle_remark`) VALUES (23, 1, NULL, '2025-11-07 15:55:17', NULL, 'CHECK_IN', NULL, NULL, NULL, 'APPROVED', '2025-11-07 15:55:17', 1, 0, 0, 415, NULL, '2025-11-07', '迟到 415 分钟', 'UNHANDLED', NULL, NULL, NULL);
COMMIT;

-- ----------------------------
-- Table structure for attendance_rule
-- ----------------------------
DROP TABLE IF EXISTS `attendance_rule`;
CREATE TABLE `attendance_rule` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `rule_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'è§„åˆ™åç§°',
  `work_start_time` time NOT NULL COMMENT 'ä¸Šç­æ—¶é—´ï¼Œæ ¼å¼ï¼š09:00:00',
  `work_end_time` time NOT NULL COMMENT 'ä¸‹ç­æ—¶é—´ï¼Œæ ¼å¼ï¼š18:00:00',
  `late_threshold` int DEFAULT '15' COMMENT 'è¿Ÿåˆ°é˜ˆå€¼ï¼ˆåˆ†é’Ÿï¼‰ï¼Œè¶…è¿‡æ­¤æ—¶é—´ç®—è¿Ÿåˆ°',
  `early_leave_threshold` int DEFAULT '15' COMMENT 'æ—©é€€é˜ˆå€¼ï¼ˆåˆ†é’Ÿï¼‰ï¼Œæå‰æ­¤æ—¶é—´ç®—æ—©é€€',
  `flexible_work` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦å¼¹æ€§å·¥ä½œåˆ¶',
  `status` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT 'ACTIVE' COMMENT 'çŠ¶æ€ï¼šACTIVE, INACTIVE',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `lunch_start_time` time DEFAULT NULL COMMENT 'åˆä¼‘å¼€å§‹æ—¶é—´ï¼ˆä¸‹åˆä¸Šç­æ—¶é—´ï¼‰ï¼Œæ ¼å¼ï¼š12:00:00',
  `lunch_end_time` time DEFAULT NULL COMMENT 'åˆä¼‘ç»“æŸæ—¶é—´ï¼ˆä¸‹åˆä¸Šç­æ—¶é—´ï¼‰ï¼Œæ ¼å¼ï¼š13:30:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='è€ƒå‹¤è§„åˆ™é…ç½®è¡¨';

-- ----------------------------
-- Records of attendance_rule
-- ----------------------------
BEGIN;
INSERT INTO `attendance_rule` (`id`, `rule_name`, `work_start_time`, `work_end_time`, `late_threshold`, `early_leave_threshold`, `flexible_work`, `status`, `create_time`, `update_time`, `lunch_start_time`, `lunch_end_time`) VALUES (1, '标准上班时间', '09:00:00', '18:00:00', 15, 15, 0, 'ACTIVE', '2025-11-07 11:36:23', '2025-11-07 15:23:11', '12:00:00', '13:30:00');
COMMIT;

-- ----------------------------
-- Table structure for leave_balance
-- ----------------------------
DROP TABLE IF EXISTS `leave_balance`;
CREATE TABLE `leave_balance` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL COMMENT 'ç”¨æˆ·ID',
  `annual_balance` decimal(5,1) DEFAULT '0.0' COMMENT 'å¹´å‡ä½™é¢ï¼ˆå¤©ï¼‰',
  `sick_balance` decimal(5,1) DEFAULT '0.0' COMMENT 'ç—…å‡ä½™é¢ï¼ˆå¤©ï¼‰',
  `personal_balance` decimal(5,1) DEFAULT '0.0' COMMENT 'äº‹å‡ä½™é¢ï¼ˆå¤©ï¼‰',
  `adjustment_balance` decimal(5,1) DEFAULT '0.0' COMMENT 'è°ƒä¼‘ä½™é¢ï¼ˆå¤©ï¼‰',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'åˆ›å»ºæ—¶é—´',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ›´æ–°æ—¶é—´',
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_id` (`user_id`),
  KEY `idx_user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='å‡æœŸä½™é¢è¡¨';

-- ----------------------------
-- Records of leave_balance
-- ----------------------------
BEGIN;
INSERT INTO `leave_balance` (`id`, `user_id`, `annual_balance`, `sick_balance`, `personal_balance`, `adjustment_balance`, `create_time`, `update_time`) VALUES (1, 1, 1.0, 2.0, 3.0, 4.0, '2025-11-07 12:15:48', '2025-11-07 12:15:48');
COMMIT;

-- ----------------------------
-- Table structure for leave_balance_log
-- ----------------------------
DROP TABLE IF EXISTS `leave_balance_log`;
CREATE TABLE `leave_balance_log` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL COMMENT 'ç”¨æˆ·ID',
  `leave_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'å‡æœŸç±»åž‹ï¼šANNUAL, SICK, PERSONAL, ADJUSTMENT',
  `change_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'å˜æ›´ç±»åž‹ï¼šINCREASE-å¢žåŠ , DECREASE-å‡å°‘, SET-è®¾ç½®',
  `amount` decimal(5,1) NOT NULL COMMENT 'å˜æ›´æ•°é‡ï¼ˆå¤©ï¼‰',
  `balance_before` decimal(5,1) DEFAULT NULL COMMENT 'å˜æ›´å‰ä½™é¢',
  `balance_after` decimal(5,1) DEFAULT NULL COMMENT 'å˜æ›´åŽä½™é¢',
  `reason` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'å˜æ›´åŽŸå› ',
  `operator_id` bigint DEFAULT NULL COMMENT 'æ“ä½œäººID',
  `related_leave_id` bigint DEFAULT NULL COMMENT 'å…³è”çš„è¯·å‡è®°å½•IDï¼ˆå¦‚æžœæ˜¯è¯·å‡æ‰£é™¤ï¼‰',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'åˆ›å»ºæ—¶é—´',
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_create_time` (`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='å‡æœŸä½™é¢å˜æ›´è®°å½•è¡¨';

-- ----------------------------
-- Records of leave_balance_log
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for leave_record
-- ----------------------------
DROP TABLE IF EXISTS `leave_record`;
CREATE TABLE `leave_record` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL,
  `type` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'ANNUAL, SICK, PERSONAL, ADJUSTMENT',
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `days` int DEFAULT NULL,
  `reason` text COLLATE utf8mb4_unicode_ci,
  `status` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'PENDING, APPROVED, REJECTED',
  `approver_id` bigint DEFAULT NULL,
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
-- Records of leave_record
-- ----------------------------
BEGIN;
INSERT INTO `leave_record` (`id`, `user_id`, `type`, `start_date`, `end_date`, `days`, `reason`, `status`, `approver_id`, `create_time`) VALUES (1, 1, 'ANNUAL', '2025-11-04', '2025-11-08', 5, '啊大萨达', 'REJECTED', 2, '2025-11-07 00:15:26');
INSERT INTO `leave_record` (`id`, `user_id`, `type`, `start_date`, `end_date`, `days`, `reason`, `status`, `approver_id`, `create_time`) VALUES (2, 1, 'ADJUSTMENT', '2025-11-07', '2025-11-07', 1, '上晚班需要休息', 'APPROVED', 2, '2025-11-07 10:47:07');
INSERT INTO `leave_record` (`id`, `user_id`, `type`, `start_date`, `end_date`, `days`, `reason`, `status`, `approver_id`, `create_time`) VALUES (3, 1, 'ANNUAL', '2025-11-04', '2025-11-20', 17, '年休', 'PENDING', NULL, '2025-11-07 17:58:21');
INSERT INTO `leave_record` (`id`, `user_id`, `type`, `start_date`, `end_date`, `days`, `reason`, `status`, `approver_id`, `create_time`) VALUES (4, 1, 'SICK', '2025-11-03', '2025-11-12', 10, '3阿达', 'PENDING', NULL, '2025-11-07 18:05:09');
INSERT INTO `leave_record` (`id`, `user_id`, `type`, `start_date`, `end_date`, `days`, `reason`, `status`, `approver_id`, `create_time`) VALUES (5, 1, 'SICK', '2025-11-04', '2025-11-21', 18, '123稍等亲 给小妹一点时间 我看一下回复您哦~\n', 'PENDING', NULL, '2025-11-07 18:06:36');
INSERT INTO `leave_record` (`id`, `user_id`, `type`, `start_date`, `end_date`, `days`, `reason`, `status`, `approver_id`, `create_time`) VALUES (6, 1, 'SICK', '2025-11-03', '2025-11-14', 12, 'asdsd ', 'PENDING', NULL, '2025-11-07 18:11:34');
INSERT INTO `leave_record` (`id`, `user_id`, `type`, `start_date`, `end_date`, `days`, `reason`, `status`, `approver_id`, `create_time`) VALUES (7, 1, 'SICK', '2025-11-10', '2025-11-26', 17, 'asdsad ', 'PENDING', NULL, '2025-11-07 18:13:27');
INSERT INTO `leave_record` (`id`, `user_id`, `type`, `start_date`, `end_date`, `days`, `reason`, `status`, `approver_id`, `create_time`) VALUES (8, 1, 'ANNUAL', '2025-11-03', '2025-11-27', 25, 'adasd大声道', 'PENDING', NULL, '2025-11-07 18:13:58');
INSERT INTO `leave_record` (`id`, `user_id`, `type`, `start_date`, `end_date`, `days`, `reason`, `status`, `approver_id`, `create_time`) VALUES (9, 1, 'PERSONAL', '2025-11-03', '2025-11-20', 18, '阿斯达萨达撒', 'PENDING', NULL, '2025-11-07 18:19:04');
INSERT INTO `leave_record` (`id`, `user_id`, `type`, `start_date`, `end_date`, `days`, `reason`, `status`, `approver_id`, `create_time`) VALUES (10, 1, 'ANNUAL', '2025-11-03', '2025-11-27', 25, '萨阿迪', 'PENDING', NULL, '2025-11-07 18:22:22');
INSERT INTO `leave_record` (`id`, `user_id`, `type`, `start_date`, `end_date`, `days`, `reason`, `status`, `approver_id`, `create_time`) VALUES (11, 1, 'ANNUAL', '2025-11-02', '2025-11-21', 20, '阿斯顿撒', 'PENDING', NULL, '2025-11-07 18:24:37');
INSERT INTO `leave_record` (`id`, `user_id`, `type`, `start_date`, `end_date`, `days`, `reason`, `status`, `approver_id`, `create_time`) VALUES (12, 1, 'ANNUAL', '2025-11-02', '2025-11-28', 27, '阿萨德撒旦', 'PENDING', NULL, '2025-11-07 18:37:57');
INSERT INTO `leave_record` (`id`, `user_id`, `type`, `start_date`, `end_date`, `days`, `reason`, `status`, `approver_id`, `create_time`) VALUES (13, 1, 'ANNUAL', '2025-10-27', '2025-11-19', 24, 'asdasd ', 'PENDING', NULL, '2025-11-07 18:38:27');
INSERT INTO `leave_record` (`id`, `user_id`, `type`, `start_date`, `end_date`, `days`, `reason`, `status`, `approver_id`, `create_time`) VALUES (14, 1, 'ANNUAL', '2025-11-03', '2025-11-20', 18, 'asdsad', 'REJECTED', 2, '2025-11-07 18:41:07');
COMMIT;

-- ----------------------------
-- Table structure for notification
-- ----------------------------
DROP TABLE IF EXISTS `notification`;
CREATE TABLE `notification` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL COMMENT 'æŽ¥æ”¶ç”¨æˆ·ID',
  `type` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'é€šçŸ¥ç±»åž‹ï¼šAPPROVAL_PENDING, APPROVAL_RESULT, SYSTEM, ATTENDANCE',
  `title` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'é€šçŸ¥æ ‡é¢˜',
  `content` text COLLATE utf8mb4_unicode_ci COMMENT 'é€šçŸ¥å†…å®¹',
  `related_id` bigint DEFAULT NULL COMMENT 'å…³è”IDï¼ˆå¦‚å®¡æ‰¹è®°å½•IDï¼‰',
  `related_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'å…³è”ç±»åž‹ï¼šOVERTIME, LEAVE, SALARY',
  `is_read` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦å·²è¯»ï¼š0-æœªè¯»ï¼Œ1-å·²è¯»',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'åˆ›å»ºæ—¶é—´',
  `read_time` datetime DEFAULT NULL COMMENT 'é˜…è¯»æ—¶é—´',
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_is_read` (`is_read`),
  KEY `idx_create_time` (`create_time`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='é€šçŸ¥æ¶ˆæ¯è¡¨';

-- ----------------------------
-- Records of notification
-- ----------------------------
BEGIN;
INSERT INTO `notification` (`id`, `user_id`, `type`, `title`, `content`, `related_id`, `related_type`, `is_read`, `create_time`, `read_time`) VALUES (4, 2, 'APPROVAL_PENDING', '待审批：请假申请', '您有新的年假申请需要审批，天数：18天', 14, 'LEAVE', 1, '2025-11-07 18:41:07', '2025-11-07 18:41:18');
INSERT INTO `notification` (`id`, `user_id`, `type`, `title`, `content`, `related_id`, `related_type`, `is_read`, `create_time`, `read_time`) VALUES (5, 1, 'APPROVAL_RESULT', '审批结果：年假申请', '您的年假申请（18天）已拒绝', 14, 'LEAVE', 1, '2025-11-07 18:41:57', '2025-11-07 18:56:39');
COMMIT;

-- ----------------------------
-- Table structure for salary_record
-- ----------------------------
DROP TABLE IF EXISTS `salary_record`;
CREATE TABLE `salary_record` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL,
  `month` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '2024-01',
  `base_salary` decimal(10,2) DEFAULT NULL,
  `bonus` decimal(10,2) DEFAULT NULL,
  `deduction` decimal(10,2) DEFAULT NULL,
  `total` decimal(10,2) DEFAULT NULL,
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
-- Records of salary_record
-- ----------------------------
BEGIN;
INSERT INTO `salary_record` (`id`, `user_id`, `month`, `base_salary`, `bonus`, `deduction`, `total`, `create_time`) VALUES (1, 1, '2024-01', 8000.00, 1000.00, 200.00, 8800.00, '2025-11-07 00:52:20');
INSERT INTO `salary_record` (`id`, `user_id`, `month`, `base_salary`, `bonus`, `deduction`, `total`, `create_time`) VALUES (2, 1, '2024-02', 8000.00, 1500.00, 200.00, 9300.00, '2025-11-07 00:52:20');
INSERT INTO `salary_record` (`id`, `user_id`, `month`, `base_salary`, `bonus`, `deduction`, `total`, `create_time`) VALUES (3, 1, '2024-03', 8000.00, 800.00, 200.00, 8600.00, '2025-11-07 00:52:20');
INSERT INTO `salary_record` (`id`, `user_id`, `month`, `base_salary`, `bonus`, `deduction`, `total`, `create_time`) VALUES (4, 2, '2024-01', 12000.00, 2000.00, 300.00, 13700.00, '2025-11-07 00:52:20');
INSERT INTO `salary_record` (`id`, `user_id`, `month`, `base_salary`, `bonus`, `deduction`, `total`, `create_time`) VALUES (5, 2, '2024-02', 12000.00, 2500.00, 300.00, 14200.00, '2025-11-07 00:52:20');
INSERT INTO `salary_record` (`id`, `user_id`, `month`, `base_salary`, `bonus`, `deduction`, `total`, `create_time`) VALUES (6, 3, '2024-01', 10000.00, 1500.00, 250.00, 11250.00, '2025-11-07 00:52:20');
INSERT INTO `salary_record` (`id`, `user_id`, `month`, `base_salary`, `bonus`, `deduction`, `total`, `create_time`) VALUES (7, 3, '2024-02', 10000.00, 1800.00, 250.00, 11550.00, '2025-11-07 00:52:20');
COMMIT;

-- ----------------------------
-- Table structure for sys_config
-- ----------------------------
DROP TABLE IF EXISTS `sys_config`;
CREATE TABLE `sys_config` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `config_key` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '配置键',
  `config_value` text COLLATE utf8mb4_unicode_ci COMMENT '配置值',
  `config_desc` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '配置描述',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `config_key` (`config_key`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='系统配置表';

-- ----------------------------
-- Records of sys_config
-- ----------------------------
BEGIN;
INSERT INTO `sys_config` (`id`, `config_key`, `config_value`, `config_desc`, `create_time`, `update_time`) VALUES (1, 'work_days', '22', '每月工作日数', '2025-11-07 10:45:16', '2025-11-07 10:45:16');
INSERT INTO `sys_config` (`id`, `config_key`, `config_value`, `config_desc`, `create_time`, `update_time`) VALUES (2, 'attendance_reminder', 'true', '考勤提醒开关', '2025-11-07 10:45:16', '2025-11-07 10:45:16');
INSERT INTO `sys_config` (`id`, `config_key`, `config_value`, `config_desc`, `create_time`, `update_time`) VALUES (3, 'salary_reminder', 'true', '薪资提醒开关', '2025-11-07 10:45:16', '2025-11-07 10:45:16');
COMMIT;

-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `role` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'EMPLOYEE, MANAGER, HR, OTHER',
  `status` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT 'ACTIVE',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
-- Records of sys_user
-- ----------------------------
BEGIN;
INSERT INTO `sys_user` (`id`, `username`, `password`, `name`, `role`, `status`, `create_time`) VALUES (1, 'employee', '123456', '张三', 'EMPLOYEE', 'ACTIVE', '2025-11-06 20:52:22');
INSERT INTO `sys_user` (`id`, `username`, `password`, `name`, `role`, `status`, `create_time`) VALUES (2, 'manager', '123456', '李经理', 'MANAGER', 'ACTIVE', '2025-11-06 20:52:22');
INSERT INTO `sys_user` (`id`, `username`, `password`, `name`, `role`, `status`, `create_time`) VALUES (3, 'hr', '123456', '王HR', 'HR', 'ACTIVE', '2025-11-06 20:52:22');
INSERT INTO `sys_user` (`id`, `username`, `password`, `name`, `role`, `status`, `create_time`) VALUES (4, 'other', '123456', '其他用户', 'OTHER', 'ACTIVE', '2025-11-06 20:52:22');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
